home *** CD-ROM | disk | FTP | other *** search
- Path: news.unt.edu!johnw
- From: johnw@jove.acs.unt.edu (John R. Williams)
- Newsgroups: comp.lang.c
- Subject: Re: given: char foo[80]; there is no such thing as element foo[80] correct? (i.e. foo[80] = '\0' is beyond the array boundary)
- Date: 22 Mar 1996 06:33:50 GMT
- Organization: University of North Texas
- Message-ID: <4ithke$mql@hermes.acs.unt.edu>
- References: <314ad16d.86316693@news> <1996Mar16.175143.10948@zcon.com>
- NNTP-Posting-Host: jove.acs.unt.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
- Syed Zaeem Hosain (szh@zcon.com) wrote:
- > >// Yes. This works nice and safely for any array of known size.
- > >foo[sizeof(foo)-1] = '\0';
-
- This is not safe even for strings if your character type is not
- 'char'. I know that sounds silly, but wchar_t *is* there for a reason,
- y'know.
-
- --
- class JohnWilliams: public Student, public Programmer {
- public:
- char const *operator&() const { return "johnw@jove.acs.unt.edu"; }
- char const *homepage () const { return "http://www.unt.edu/~johnw"; }
- };
-